<template>
  <up-card
      :sub-title="scheduleToView?.full_work !== undefined ? translateFullWork(scheduleToView?.full_work) : undefined"
      :title="scheduleToView?.username"
  />
  <up-list>
    <up-list-item v-for="schedule in scheduleToView?.scheduleList">
      <div class="bg-white">
        <up-cell :title="schedule.day" :value="schedule.week" is-link @click="handleCellClick(schedule.day)"/>
      </div>
    </up-list-item>
  </up-list>
</template>

<script lang="ts" setup>
import {storeToRefs} from "pinia";
import {useScheduleStore} from "@/store/schedule";
import {translateFullWork} from "@/api/types/schedule/translate";

const {scheduleToView} = storeToRefs(useScheduleStore())

function handleCellClick(date: string) {
  uni.navigateTo({url: `/pages/admin/schedule/edit-schedule?date=${date}`})
}
</script>
<style lang="scss" scoped>
.bg-white {
  background-color: white;
}
</style>
